﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Common;

namespace Library
{
    public partial class Authorization : Form
    {
        AccessToDataLibrary.AccessToDataLibrary accessToDataLibrary;
        public User user;
        public Authorization(AccessToDataLibrary.AccessToDataLibrary accessToDataLibrary)
        {
            InitializeComponent();
            this.accessToDataLibrary = accessToDataLibrary;
        }

        private void Login_btn_Click(object sender, EventArgs e)
        {
            user =
               accessToDataLibrary.CheckUser(UserName_txbx.Text.Trim(), User.GetHashString(Password_txbx.Text.Trim()));
           if (user != null)
           {
               DialogResult = System.Windows.Forms.DialogResult.OK;
           }
           else
           {
               MessageBox.Show("Такая пара Логин/пароль не найдена.");
               return;
           }
        }
    }
}
